Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

322
Vistas
NPM TypeORM - "Error: Duplicate migrations" after modifying/deleting migration file

I previously add a column to an existing table using, npm run migration:generate <filename>.

However, I later realized that I misspelled the column name so I wanted to rename the column. (showComission -> showCommission)

Since it was just in a local environment, I modified the column name on the migration file and run npm run migration:run.

The duplicated migration error occurred and here's the log.

**addShowCommissionToCorporationProfile1643792138368 is the modified export class name.

typeorm migration:run

query: SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'abc' AND TABLE_NAME = 'migrations'

query: SELECT * FROM abc.migrations migrations ORDER BY id DESC

Error during migration run:
Error: Duplicate migrations: addShowCommissionToCorporationProfile1643792138368

at MigrationExecutor.checkForDuplicateMigrations
at MigrationExecutor.getMigrations
at MigrationExecutor.<anonymous> 
at step 
at Object.next 
at fulfilled 
at processTicksAndRejections npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! abc-api@1.0.0 migration:run: `typeorm migration:run`

npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the abc-api@1.0.0 migration:run script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

After that I try to revert npm run migration:revert, but the exact same error occurred. So instead, I changed the migration file back to its initial state and use npm run migration:generate --filename to create migration file for renaming the column but the same error stills occurred. Lastly, I deleted newly created migration file and run only the original migration file (initial state) and run migration again, but the same error stills occurred.

Can anyone advise me how could I fixed this mess?

I just wanted to rename the column...

Please let me know if you need any additional info or more clarification about the situation.

Appreciate all your helps.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I exec npm run build and the problem solved.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda